import type { HLJSApi } from "highlight.js";
export async function highlightcodeele(element: HTMLElement) {
    const hm = await import("./highlight.min.js");
    //@ts-ignore
    const hljs = hm.default as HLJSApi;
    const language =
        [...element.classList.values()]
            .filter((s) => s.startsWith("language-"))[0]
            ?.slice("language-".length) || "";
    const lang = language;
    const hljslanguage = hljs.getLanguage(lang);
    if (hljslanguage) {
        hljs.highlightElement(element);
        return;
    } else {
        const code = element.textContent?.trim();
        if (!code) {
            return;
        }
        element.innerHTML = hljs.highlightAuto(code).value;
        return;
    }
}
